package binary;

public class Demo05 {
    public static void main(String[] args) {
        /*
         * 补码对称
         */
        int n = 56;
        int m = ~n + 1;
        System.out.println(m); //-56
        System.out.println(~56);//-57
        //运算过程分析
        System.out.println(Integer.toBinaryString(n));
        System.out.println(Integer.toBinaryString(~n));
        System.out.println(Integer.toBinaryString(~n+1));
        //注意：最小值，不能取相反数！
        int min = Integer.MIN_VALUE;
        int k = -min;
        System.out.println(k);
    }
}
